(1) Read the notes here and those shown by clicking on the button "PrFlds Parameter Layout".
(2) Copy a card, from a stack you want printed, to the end of this stack.
(3) Arrange the fields the way you want then printed on the page (location, size, font, etc.).
(4) Return to this card. Click on the "Build Print Specs" button on this card and answer the questions.
(5) Make any embellishments to the Specs that you want (see instructions in Parameter Layout text).
(6) Click on the "print example" button.
(7) Install PrFlds XCMD into your stack, copy the specs field (with contents) and print button into your stack.
ABOUT THIS XCMD:
PrFlds is an external command (XCMD) that gives general purpose printing capabilities for the content of background fields of a stack. This version (1.9) is limited to 100 fields (or items) per card.
PrFlds allows for specification of text areas for each background field. These text areas may be anywhere on the printed page and of any size and the text in the area may be any one of any fonts recognized by the System, any size, style, line height and justification. The text area may also be enclosed by a box.
The collection of fields printed from a card (hereafter called a Record) may also be printed in columns on the page. For example, the definitions of the text areas for a record may fit within a space 3.5 inches wide by 3.5 inches high (thus printing in two columns with three records per column). The text printed may be the contents of a background field, any other text, or even the evaluation of a HyperTalk expression (e.g. the long date). The pages of the report produced by PrFlds may also have a title line, including page numbers.
Selection criteria can be specified, in the form of a HyperTalk function handler and located in the stack or background script. With this option, a certain subset of the cards of the background may be printed.
Click on the button "PrFlds Parameter Layout" for a description of the calling methods of PrFlds.
Changes in PrFlds to make version 1.9: a MAJOR bug fix (a problem if more objects were specified than the number of bkgnd fields). Also better error recovery, i.e. if something goes wrong, it should return properly.
PrFlds was written by Joseph F. Buchanan at the University of Utah Computer Center and is available for use by anyone provided that proper credit is given for it and its use is not for profit. Inquiries and questions may be directed to me at the University of Utah Computer Center at (801) 581-6802 or AppleLink: A91.
-- part contents for card part 17
----- text -----
PrFlds is VERY general purpose and is therefore somewhat cumbersome in its specifications. Most of the specifications need to be loaded into a variable (container) and the name of the variable is then passed as the first parameter to the XCMD. The second parameter specifies options and the third parameter (if needed) contains the name of a handler (hyperTalk function handler found in the background or stack script). LIMITS: This version of PrFlds (1.9) is limited to 100 objects per record (card) in the report.
The options available to PrFlds are as follows:
•N - Do not send output to the printer. Instead, show the output on the screen. This will show a test page.
•B - Process cards only of this background (of the card showing when PrFlds is invoked).
Note: if all cards are processed and different backgrounds are encountered where ANY of the specified fields do not exist for that particular background, an error will occur and the print process will fail.
•P - Do a Page Setup dialog. This is useful for specifying page orientation and size.
•S - Look for selection criterea in a HyperTalk function (the name of which is in the third parameter).
•U - Underline, i.e. draw a line on the page after each record (all fields printed for each card).
•V - Show the version of PrFlds. This will appear in a dialog box before printing begins.
Example:
prFlds "specs","BSUP","ChooseCard(23)"
and the "ChooseCard" hyperTalk function handler returning TRUE or FALSE. This feature is described in detail if you click on the "Special Selection Function" button below.
The example shown will display a Page Setup dialog before printing. When printing, it will select only those cards of the background satisfy the condition specified in the function ChooseCard. A line will be drawn after each record.
The "Specs" information is as follows:
• line 1:
• item 1: The number of cards to be printed (or examined). This is usually the number of cards of the
background or stack. If, instead, you desire to print multiple copies if one record (the
contents of the current card), then precede this number by the letter "R".
• item 2: The number of columns per page. NOTE - Column boundaries are calculated by dividing the
number of columns into the page width. If the size and location parameters of individual fields
exceed these boundaries, those areas of the printed page will be overwritten.
• item 3: The number of objects to be printed in the record. This includes each field as well as other
information that is specified in the subsequent lines of this "Specs" information area. This is
usually the number of lines of "Specs" minus 1.
• item 4: The size of the gap showing between records (and at the top of the page).
• item 5: The title to show at the top of each page. If there is something in this item, even if it is a
space character, then a title will be printed, along with a page number, otherwise no title nor
page numbers will be printed.
• all other lines (one line per object or field):
• item 1: Object identification - one of the following:
a. The background field ID number (a positive number).
OR
b. The negative value of a background field ID number - The name of the background field is to
be printed instead of its value.
OR
c. The letter "X" - in this case the text found in item 12 will be evaluated as a HyperTalk
expression and used in this place.
OR
d. The number "0" - The text in item 12 is to be printed as is.
NOTE: If item 12 is blank for choices c or d above, then no text will be printed, rather, a line will
be drawn connecting the points specified in items 2 and 3 with those in items 4 and 5.
• items 2 and 3: The coordinates of the top left corner of the rectangle to contain the text specified in
item 1.
• items 4 and 5: The coordinates of the bottom right corner of the rectangle to contain the text
specified in item 1.
NOTE: The coordinates are specified in the same manner as that of the Macintosh screen, i.e. the top
left corner of the screen is 0,0 and the bottom right is 512,342. Paper sizes are appropriately
larger with the size being approximately 75 dots per inch. PrFlds DOES NOT check to see if page
boundaries are exceeded. If you specify areas beyond the physical page, the specified text will not
show. Also, note that if a box os to be drawn around a text object, it will appear a few pixels
beyond the specified rectangle and can therefore be drawn off the edge of the page.
ALSO: As explained in item 1, a line may be drawn from the point defined by items
2 and 3 to the point defined by items 4 and 5.
• item 6: The Font name. This can be any font name as recognized by the System.
• item 7: The Font size.
• item 8: The text height (the height of the line).
• item 9: The text style. Use the first letter of the style. Combine as many as you like. These can
• item 10: The text alignment: Center, Left or Right.
• item 11: Border? If yes, then a border is drawn around the text box, otherwise not.
• item 12: A text description. This is treated as a comment and ignored unless item 1 is "0" or "X".
A button has been programmed on this card to take a card of background fields and construct a print specifications list based on those background fields. You can copy a card from your stack and paste it into this stack and then use the button to see how to construct the print specifications. You may not want the same arrangement of fields in your printed report as is on your card, so you might first re-adjust the location of your fields and eliminate some fields from the constructed list. You may also wish to embellish the record with other objects like field names, additional information and borders.
Note: The physical size on the paper of the area to contain the record objects is determined by the rectangles specified for the record objects. The highest number of the item 4 parameters of the objects list is used as the height of the record rectangle. The height of the record plus the record gap will be used to determine how many records can fit on a page.
Other Notes:
As PrFlds works, it examines all cards, the cards will appear on the screen as they are considered.
As the report is being printed, a status is shown in the message window showing the approximate progress (by page number being processed and percent of cards of the stack). This progress is only an approximate and may not be totally accurate.
Printing will not actually begin until the entire report is processed. Then if the print does not happen, it may be that there was not enough room on the system disk or in memory to assemble the report (or else that disk was locked).
-- part contents for card part 18
----- text -----
In printing your information from a stack, you may want to extract a subset from the total collection of cards of the background. The third parameter to the PrFlds XCMD will be used to make the determination whether a particular card is to be printed.
The following is the method loop of card examination:
• a. If the S option is specified, then evaluate the function whose name is found in the third parameter.
- if the returned value of the function is FALSE, then ignore the card
b. if the S option is not specified, OR if the value returned is TRUE, then process the card.
• Go to the next card of this background.
The function will usually be a hyperTalk function handler found in the background or stack script, but it might also be something else that returns TRUE or FALSE.
An example is as follows:
prFlds "specs","S","ChooseCard(23)"
function ChooseCard xxx
if field age>xxx then
return TRUE
else
return FALSE
end if
end ChooseCard
The card will be chosen if it has a value in the background field AGE of greater than 23.
ADDITIONAL INFORMATION:
In most cases, a Control-period will terminate the process of printing. Sometimes the XCMD might be in your function if there is some loop problem. Therefore PrFlds was designed to also look for a "Cancel" to be returned from the function and then cancel the entire print process. A use of this is shown below:
function ChooseCard xxx
if the commandKey is down then -- Note: we cannot check for a period, only the commandKey
return "Cancel"
exit ChooseCard
end if
if field age>xxx then
return TRUE
else
return FALSE
end if
end ChooseCard
In this example, if you hold the command key down while the selection function is invoked, the "Cancel" message will be returned to PrFlds and the process will terminate.